package com.act.moudles.user.entity;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

/**
 * 菜单模板表(Combo)表实体类
 *
 * @author makejava
 * @since 2023-05-08 00:25:54
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "s_combo")
public class ComBo {
    //id
    @TableId(value = "id",type= IdType.AUTO)
    private Long id;
    //套餐名称
    private String comboName;
    //套餐级别
    private Integer comboLevel;
    //删除标志（1代表存在 0代表删除）
    private Integer delFlag;
    //创建者
    private String createBy;
    //创建时间
    private Date createTime;
    //更新者
    private String updateBy;
    //更新时间
    private Date updateTime;
    //备注
    private String remark;
    //套餐编码
    private String comboCode;

    @TableField(exist = false)
    private Integer menuCounts;


    public LambdaQueryWrapper<ComBo> buildQuery(){
        LambdaQueryWrapper<ComBo> query = new LambdaQueryWrapper<>();
        query.eq(ComBo::getDelFlag,1);
        query.eq(id != null ,ComBo::getId,id);
        query.eq(comboLevel != null,ComBo::getComboLevel,comboLevel);
        query.like(StringUtils.isNotEmpty(comboName),ComBo::getComboName,comboName);
        return query;
    }


}

